<?php

Solar::loadClass('Domain51_Controller_Abstract', true);

class Domain51_Controller_PageType extends Domain51_Controller_Abstract
{
    protected $_Domain51_Controller_PageType = array(
        'locator_type' => 'Controller_Model_Locator'
    );
    
    protected $_view = null;
    protected $_locator = null;
    protected $_sub_controller = null;
    
    public function __construct($config = null)
    {
        parent::__construct($config);
        
        // load Controller_Model_Locator
        $this->_locator = Solar::factory($this->_config['locator_type']);
        
        // initial _view property
        $this->_initView();
    }
    
    public function dispatch($spec)
    {
        $this->_sub_controller = $this->_locator->locate($spec);
        if ($this->_sub_controller === false) {
            throw $this->_exception(
                'ERR_CONTROLLER_NOT_FOUND',
                array($spec->path)
            );
        }
        return $this->_sub_controller->dispatch($spec);
    }
}

?>